package com.company.meituan2021;

import java.util.Scanner;

public class Main3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = sc.nextInt();
        }
        int res = num[0];
        for (int i = 1; i <= n; i++) {
            if(i != 1){
                res ^= num[i - 1];
            }

            for (int j = 1; j < i; j++) {
                if (j == 1 || i % j == 0) {
                    continue;
                }
                res ^= i % j;
            }

            res ^= (n - i ) % 2  == 0 ? 0 : i;
        }
        System.out.println(res);

    }
}
